#include<iostream>
#include"Vector.h"

int main()
{
    int n;
    std::cin>>n;
    
    Vector<int> c(n);

    //生成大小为的向量用于测试构造函数以及运算符[]的重置
    for(int i=0;i<n;i++)
	std::cin>>c[i];
    std::cout<<"The Vector c is: ";
    for(int i=0;i<n;i++)
	std::cout<<c[i]<<' ';
    std::cout<<std::endl;
    

    //用于检测赋值函数以及‘=’的重置
    Vector<int> d;
    Vector<int> a(c);
    d = c;
    std::cout<<"The Vector d is: ";
    for(int i=0;i<n;i++)
	std::cout<<d[i]<<' ';
    std::cout<<std::endl;
    std::cout<<"The Vector a is: ";
    for(int i=0;i<n;i++)
	std::cout<<a[i]<<' ';
    std::cout<<std::endl;

    //测试size()以及resize()函数
    std::cout<<"the size of c:"<<c.size()<<std::endl;
    c.resize(8);
    std::cout<<"after resize of c, the size of c is:"<<c.size()<<std::endl;
    
    //测试capacity(),reserve(),最后在resize()的过程中涉及到的容量改变

    std::cout<<"the capacity of c is: "<<c.capacity()<<std::endl;
    //测试当resize()中的newsize小于容量时容量的变化。
    c.resize(12);
    std::cout<<"when newsize is smaller than capacity,the capacity of c is: "<<c.capacity()<<std::endl;
    //测试当resize()中的newsize大于容量时容量变化。
    c.resize(25);
    std::cout<<"when newsize is bigger than capacity,the capacity of c is: "<<c.capacity()<<std::endl;
    //测试当reserve()中的newcapacity小于size时。
    c.reserve(2);
    std::cout<<"when newcapacity is smaller than size, the capacity of c is: "<<c.capacity()<<std::endl;
    //测试当reserve()中的newcapacity大于size时
    c.reserve(20);
    std::cout<<"when newcapacity is bigger than size, the capacity of c is: "<<c.capacity()<<std::endl;

    //empty()函数的测试，先生成一个空向量b，以及有大小的向量d;
    Vector<int> b;
    std::cout<<"whether the vector b is empty :"<<b.empty()<<std::endl;
    std::cout<<"whether the vector d is empty :"<<d.empty()<<std::endl;

    //测试back()函数
    std::cout<<"the last element of vector d is: "<<d.back()<<std::endl;

    //最后利用迭代器iterator测试push_back()以及pop_back，并且对d进行操作;
    d.push_back(5);
    std::cout<<"after push_back() the last element of Vector d is: "<<d.back()<<std::endl;
    std::cout<<"after push_back() the vector of d is "<<std::endl;
    Vector<int>::iterator i;
    for(i = d.begin(); i!= d.end(); i++)
	std::cout<<*i<<' ';
    std::cout<<std::endl;
    //执行两次pop_back，并且对d操作
    d.pop_back();
    d.pop_back();
    std::cout<<"after twice pop_back() the last element of d is: "<<d.back()<<std::endl;
    std::cout<<"after twice pop_back() the vector of d is "<<std::endl;
    for(i = d.begin(); i!= d.end(); i++)
	std::cout<<*i<<' ';
    std::cout<<std::endl;
    
	
    
    
    
    
   


    
    return 0;
}
